﻿<extend name="Public:base" />
<block name="title"><title>快速注册</title></block>
<block name="header_styles">
    <!--<link href="__Public__/js/kendo.ui/kendo.bootstrap.min.css" rel=" stylesheet" />
    <link href="__Public__/js/kendo.ui/kendo.common-bootstrap.min.css" rel=" stylesheet" />-->


</block>
<block name="main">
    <div class="register-container">
        <div class="register-form">
            <form action="" method="POST" id="form_signup2">
                <div class="form-section">
                    <div class="form-section-heading">
                        设置头像
                    </div>
                    <div class="form-section-content">
                        <iframe src="{:U('/Index/sp')}" scrolling="no" frameborder="0" width="502" height="360" class="photo"></iframe>
                        <!--<div class="logo-box">
                            <a href="javascript:void(0);" class="btn-upload">点击上传</a>
                        </div>-->
                        <div class="help-block text-center">
                            上传真实头像，可信度更高，最佳尺寸建议300*300
                        </div>
                        <div class="text-center">
                            <span data-valmsg-for="uploadurl" data-valmsg-replace="true" style="padding-left: 10px;"></span>
                        </div>
                    </div>
                </div>
                <input type="text" name="uploadurl" id="uploadurl" data-val="true" data-val-required="请上传头像" class="opacity0" />
                <div class="form-section">
                    <div class="form-section-heading">
                        必填信息
                    </div>
                    <div class="form-section-content form-horizontal">
                        <div class="form-group">
                            <label class="control-label col-xs-3">设 置 昵 称</label>
                            <div class="col-xs-8">
                                <input type="text" class="form-control" id="nickname" name="nickname" placeholder="在此处输入昵称"
                                       maxlength="20"
                                       data-val="true" data-val-required="此处未填写"
                                       data-val-remote="该昵称已存在"
                                       data-val-remote-url="{:U('Login/signup_checkNicknameAjax')}" />
                                <span class="form-control-static" data-valmsg-for="nickname" data-valmsg-replace="true"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-xs-3">设 置 性 别</label>
                            <div class="col-xs-8">
                                <label class="radio-inline">
                                    <input type="radio" checked name="gender" value="1" /> 男
                                </label>
                                <label class="radio-inline">
                                    <input type="radio" name="gender" value="2" /> 女
                                </label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="control-label col-xs-3">手 机 号 码</label>

                            <div class="col-xs-8">
                                <input type="text" class="form-control" id="mobile" name="mobile"
                                       data-val="true" data-val-required="电话号码不能为空"
                                       data-val-regex="无效电话号码" data-val-regex-pattern="^(1[34587])[0-9]\\d{8}$" value="{$userinfo.mobile}" maxlength="11" />
                                <span data-valmsg-for="mobile" data-valmsg-replace="true"></span>
                                <div class="help-block">请填写您的手机号，以便般若虾的工作人员能即时联系上您</div>

                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-xs-3">所&nbsp;&nbsp;&nbsp;在&nbsp;&nbsp;&nbsp;地</label>

                            <div class="col-xs-8">
                                <div class="row small">
                                    <div class="col-xs-4">
                                        <select id="ddlProvince" name="province" class="form-control" data-val="true" data-val-required="此处未选择"></select>
                                    </div>
                                    <div class="col-xs-2">
                                        <p class="form-control-static">省/市</p>
                                    </div>
                                    <div class="col-xs-4">
                                        <select id="ddlCity" name="city" class="form-control" data-val="true" data-val-required="此处未选择">
                                            <option value="">请选择</option>
                                        </select>
                                    </div>
                                    <div class="col-xs-2">
                                        <p class="form-control-static">区/市</p>
                                    </div>
                                </div>
                                <span data-valmsg-for="province" data-valmsg-replace="true"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-xs-3">出&nbsp;生&nbsp;日&nbsp;期</label>
                            <div class="col-xs-8">
                                <div class="row small">
                                    <div class="col-xs-4">
                                        <select id="ddlYears" name="birthdayYear" class="form-control" style="width:80%;display:inline-block;" data-val="true" data-val-required="此处未选择"></select>
                                        &nbsp;年
                                    </div>
                                    <div class="col-xs-4">
                                        <select id="ddlMonths" name="birthdayMonth" class="form-control" style="width:80%;display:inline-block;" data-val="true" data-val-required="此处未选择"></select>
                                        &nbsp;月
                                    </div>

                                    <div class="col-xs-4">
                                        <select id="ddlDays" name="birthdayDay" class="form-control" style="width:80%;display:inline-block;" data-val="true" data-val-required="此处未选择"></select>
                                        &nbsp;日
                                    </div>

                                </div>
                                <span class="validation-group">
                                    <span data-valmsg-for="birthdayDay" data-valmsg-replace="true"></span>
                                    <span data-valmsg-for="birthdayYear" data-valmsg-replace="true"></span>
                                    <span data-valmsg-for="birthdayMonth" data-valmsg-replace="true"></span>
                                </span>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="control-label col-xs-3">当 前 职 业</label>

                            <div class="col-xs-8">
                                <input type="text" class="form-control" id="vocation" name="vocation" maxlength="10" placeholder="在此处输入您当前职业" data-val="true" data-val-required="此处未填写" />
                                <span data-valmsg-for="vocation" data-valmsg-replace="true"></span>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="control-label col-xs-3">工 作 年 限</label>
                            <div class="col-xs-8">
                                <select id="workYears" name="workYears" class="form-control">
                                    <for start="1" end="16">
                                        <option value="{$i}">{$i}</option>
                                    </for>
                                    <option value="15+">15+</option>
                                </select>
                                <div class="help-block">请如实填写您的工作年限</div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-xs-3">自 我 简 介</label>
                            <div class="col-xs-8">
                                <textarea type="text" class="form-control" id="introduction" name="introduction" rows="10" placeholder="请您填写简要的自我描述，比如就职行业、职位、擅长的领域；个人爱好等，200字以内。" maxlength="200" data-val="true" data-val-required="此处未填写"></textarea>
                                <span data-valmsg-for="introduction" data-valmsg-replace="true"></span>
                            </div>
                        </div>
                    </div>
                </div>





                <div class="form-buttons text-center">
                    <button type="button" class="btn btn-success" id="btnSubmit">提交</button>
                </div>
            </form>
        </div>
    </div>
</block>
<block name="footer_scripts">
    <script type="text/x-kendo-template" id="tplSingupSuccess">
        恭喜您，已完成注册！。
        <br />
        现在您可以在网站浏览信息，但若要使用更多功能，请用邮箱激活账号。
        <br />
        <button type="button" class="smallbtn btn-default active-account">发送激活邮件</button>
        <br />
        您现在可以
        <a href="{:U('/')}" style="text-decoration:underline;">四处逛逛</a>
        <br />
        <span id="smNotice" class="rpnotice"></span>
    </script>

    <!--<script src="__Public__/js/location_cn.js"></script>-->
    <script type="text/javascript">

        function photoCropCompleted(url) {
            $("#uploadurl").val(url);
        }

        function resetButtonClick() {
            $("#uploadurl").val("");
        }
    </script>

    <script type="text/javascript">
        require(["jquery", "modules/message", "bootstrap", "libraries/location_cn", "libraries/common", "kendoui/kendo.web.min"],
            function ($, messageBox) {
                $(document).ready(function () {
                    bindDropDownListData("#ddlYears", 1935, new Date().getFullYear(), onYearChange);
                    bindDropDownListData("#ddlMonths", 1, 12, onYearChange);
                    bindDropDownListData("#ddlDays", 1, 31);

                    for (var item in cities) {
                        if (item == "请选择") {
                            $("#ddlProvince").append("<option value=''>" + item + "</option>");
                        } else {
                            $("#ddlProvince").append("<option value='" + item + "'>" + item + "</option>");
                        }
                    }

                    $("#ddlProvince").change(function () {
                        var selected = $(this).val();
                        if (selected != "") {
                            $("#ddlCity option").remove();
                            //$("#ddlCity").append("<option value=''>请选择</option>");
                            var selectCities = cities[selected];
                            for (var i = 0; i < selectCities.length; i++) {
                                $("#ddlCity").append("<option value='" + selectCities[i] + "'>" + selectCities[i] + "</option>");
                            }
                        }
                    });

                    $("#btnSubmit").click(function () {

                        if ($("#form_signup2").valid()) {
                            $("#btnSubmit").button("loading");
                            var postData = $("#form_signup2").serialize();
                            $.ajax({
                                url: "{:U('Login/signup_commitPersonAjax')}",
                                type: "post",
                                data: postData,
                                dataType: "json",
                                success: function (data) {
                                    $("#btnSubmit").button("reset");
                                    var vdata = eval(data);
                                    if (vdata.success == 1) {
                                        messageBox.show({
                                            title: "完善资料",
                                            contentId: "#tplSingupSuccess",
                                            afterOpen: function () {
                                                $('#smNotice').hide();
                                            },
                                            afterClose: function () {
                                                window.location.href = "{:U('/')}";
                                            }
                                        });
                                    } else {
                                        messageBox.alert({
                                            content: vdata.msg,
                                            sure: function () {
                                                location.href = "{:U('User/baseinfo', array('new'=>1))}";
                                            }
                                        });
                                    }
                                }
                            });
                        }
                    });
                });

                function onYearChange(e) {
                    var year = $("#ddlYears :selected").val();
                    var month = $("#ddlMonths :selected").val();
                    if (year != "" && month != "") {
                        var selected = new Date(year, month - 1);
                        bindDropDownListData("#ddlDays", 1, selected.daysInMonth());
                    }
                }

                $(document).on("click", ".active-account", function () {
                    kendo.ui.progress($("#boxAlert"), true);
                    var nickname = $('#nickname').val();
                    var url = "{:U('/Login/activeaccount_ajax')}";
                    $.post(url, { 'name': nickname }, function (data) {
                        kendo.ui.progress($("#boxAlert"), false);
                        var vdata = eval(data);
                        $('#smNotice').text(vdata.msg);
                        $('#smNotice').show();
                    }, 'json');
                });
            });

    </script>
</block>